/**
 * 数字格式化时分秒毫秒
 * @param times 数字 例 1200,10,0001
 * @param fps //帧率 
 * @returns 
 */
export function getFomatTime(times: any = 0, fps: any = 25) {
  if (times <= 0) {
    return '00:00:00:00'
  }
  let hm: any = null
  let it: any = null
  hm = 0
  it = times.toString().split('.')
  if (it.length === 2) {
    hm = '0.' + it[1]
  }
  hm = 1000 * parseFloat(hm)
  hm = hm / (1000 / fps)
  hm = Math.floor(hm)
  let time: any = parseInt(it[0])
  var hours: any = Math.floor(time / 3600)
  if (hours < 10) {
    hours = "0" + hours
  }
  var mintures: any = Math.floor(time / 60 % 60)
  if (mintures < 10) {
    mintures = '0' + mintures
  }
  var selects: any = Math.floor(time % 60)
  if (selects < 10) {
    selects = '0' + selects
  }
  if (hm < 10) {
    hm = '0' + hm
  }
  return `${hours}:${mintures}:${selects}:${hm}`
}
/**
 * 字符串转对象
 * @param obj     需要定义属性的当前对象 
 * @param key    当前需要定义的属性名 
 * @param value    描述符 一般是一个对象 
 */
export function stringToObject(obj: any, key: any = '', value: any) {
  if (key in obj) {
    obj = Object.defineProperty(obj, key, {
      value: value,// 属性值
      enumerable: true, //控制属性是否可以枚举，默认值是false
      writable: true, //控制属性是否可以被修改，默认值是false
      configurable: true //控制属性是否可以被删除，默认值是fals
    })
  } else {
    obj[key] = value

  }
  return obj
}
